﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace He.Web.manage.site
{
    public partial class info : He.Web.UI.Manage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //chkLoginLevel("editSiteInfo");
                ShowInfo();
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            //网站信息
            Model.site_info model = new BLL.site_info().GetModelByLang(lang);
            model.WebName = txtWebName.Text.Trim();
            model.WebTitle = txtWetTitle.Text.Trim();
            model.WebKeyWords = txtWebKeyword.Text.Trim();
            model.WebDescription = txtWebDesc.Text.Trim();
            model.BeiAnHao = txtBeiAn.Text.Trim();
            //WebModel.WebAuthor = txtWebAuthor.Text.Trim();
            model.LinkName = txtLinkName.Text.Trim();
            model.LinkName2 = txtLinkName2.Text.Trim();
            model.Tel = txtTel.Text.Trim();
            model.Tel2 = txtTel2.Text.Trim();
            model.Fax = txtFax.Text.Trim();
            model.Fax2 = txtFax2.Text.Trim();
            model.Phone = txtPhone.Text.Trim();
            model.Phone2 = txtPhone2.Text.Trim();
            model.Address = txtAddress.Text.Trim();
            model.Address2 = txtAddress2.Text.Trim();
            model.Email = txtEmail.Text.Trim();
            model.Email2 = txtEmail2.Text.Trim();
            model.QQHao = txtQQ.Text.Trim();
            model.QQHao2 = txtQQ2.Text.Trim();
            string filePath = string.Format("~/config/lang_{0}.config", this.lang);
            new BLL.config().SaveConfig<Model.site_info>(model, filePath);
            SaveLogs("[系统管理]系统参数设置");
            JscriptPrint("系统参数设置成功啦！", Request.RawUrl, "Success");
        }

        #region 赋值操作=================================
        private void ShowInfo()
        {
            //网站信息
            Model.site_info model = new BLL.site_info().GetModelByLang(lang);
            txtWebName.Text = model.WebName;
            txtWetTitle.Text = model.WebTitle;
            txtWebKeyword.Text = model.WebKeyWords;
            txtWebDesc.Text = model.WebDescription;
            txtBeiAn.Text = model.BeiAnHao;
            //txtWebAuthor.Text = model.WebAuthor;
            txtLinkName.Text = model.LinkName;
            txtLinkName2.Text = model.LinkName2;
            txtTel.Text = model.Tel;
            txtTel2.Text = model.Tel2;
            txtFax.Text = model.Fax;
            txtFax2.Text = model.Fax2;
            txtPhone.Text = model.Phone;
            txtPhone2.Text = model.Phone2;
            txtAddress.Text = model.Address;
            txtAddress2.Text = model.Address2;
            txtEmail.Text = model.Email;
            txtEmail2.Text = model.Email2;
            txtQQ.Text = model.QQHao;
            txtQQ2.Text = model.QQHao2;
        }
        #endregion
    }
}
